package com.boesch.electroOffice.dataaccess.dao;

import java.util.List;

import org.joda.time.LocalDate;

import com.boesch.electroOffice.dataaccess.common.IllegalDataAccessException;
import com.boesch.electroOffice.model.electroOffice.Appointment;
import com.liferay.portal.model.User;

/**
 * This interface allocates all methods for AppointmentsDaoImpl.
 * The methods are only called by the business layer.
 * If there is an error on executing the method, a illegalDataAccessException will be thrown.
 * 
 * @author Ralph Koster
 *
 */
public interface AppointmentDao {

	/**
	 * Reads all appointments from electroOffice database.
	 * Complete Javadoc
	 * 
	 * @return List<AppointmentElectroOffice> appointments
	 * @throws IllegalDataAccessException
	 */
	public List<Appointment> readAllAppointments() throws IllegalDataAccessException;

	/**
	 * Reads all appointments from electroOffice database where user has working hours
	 * and this working hours are between two dates.
	 * Complete Javadoc
	 * 
	 * @param LocalDate datePlusDays 
	 * @param LocalDate dateOfMonday 
	 * @param int userId 
	 * 
	 * @return List<AppointmentElectroOffice> appointments
	 * @throws IllegalDataAccessException
	 */
	public List<Appointment> readAppointmentsWhereUserHasWorkingHours(long userId, LocalDate dateOfMonday, LocalDate datePlusDays) throws IllegalDataAccessException;

	/**
	 * Reads an appointment by appointment Id
	 * Complete Javadoc
	 * 
	 * @param Integer appointmentId
	 * @return Appointment appointment
	 * @throws IllegalDataAccessException ex
	 */
	public Appointment readAppointmentById(Integer appointmentId) throws IllegalDataAccessException;

	/**
	 * Saves an appointment to electroOffice database
	 * Complete Javadoc
	 * 
	 * @param Appointment appointment
	 * @return String returnCode
	 * @throws IllegalDataAccessException
	 */
	public String saveAppointmentOnDatabase(Appointment appointment, User currentUser) throws IllegalDataAccessException;

	/**
	 * Updates an appointment on electroOffice database
	 * Complete Javadoc
	 * 
	 * @param Appointment appointment
	 * @return String returnCode
	 * @throws IllegalDataAccessException
	 */
	public String updateAppointmentOnDatabase(Appointment appointment, User currentUser) throws IllegalDataAccessException;

}
